package com.sy.simpleegg.util;


import static com.sy.simpleegg.constant.Constant.PWD_DEFAULT;

import com.sy.simpleegg.constant.Constant;

public class SPHelper {

    private static final String PASSWORD = "localpassword";
    private static final String PASSWORDERRCOUNT = "localpassword_err_count";
    private static final String SHOWLOGO = "show_logo";
    private static final String STOREANDCONTACT = "store_and_contact";
    private static final String ONDUTY_CODE = "onduty_code";
    private static final String DEVICE_CASH = "device_cash";
    private static final String DENOMINATION_1 = "denomination_1";
    private static final String COIN_ENABLE = "coin_enable";
    private static final String BANKNOTE_ENABLE = "banknote_enable";
    private static final String BACKSCAN_ENABLE = "backnote_enable";
    private static final String DEVICE_NUMBER = "device_number";
    private static final String CASH_PACKAGE = "cash_package";
    private static final String ICCIC = "SIM_ICCID";
    private static final String CONTROL_PORT = "control_port";
    private static final String BANKNOTE_PORT = "banknote_port";
    private static final String BACKSCAN_PORT = "backscan_port";
    private static final String HOME_BTN_LIST = "home_btn_list";
    private static final String MOTOR_1_STATE = "motor_1_state";
    private static final String MOTOR_2_STATE = "motor_2_state";
    private static final String MOTOR_OUT_TYPE = "motor_out_type";
    private static final String ACCESS_PLATFORM = "access_platform";
    private static final String CONTROL_TYPE = "control_type";
    private static final String AUTO_IN_COIN = "auto_in_coin";
    private static final String GOOD_TYPE = "good_type";

    /**
     * 获取后台密码
     * @return pwd
     */
    public static String getBackstagePwd() {
        return SPUtils.getInstance().getString(PASSWORD, PWD_DEFAULT);
    }

    /**
     * 保存密码
     * @param pwd 密码
     */
    public static void setBackstagePwd(String pwd){
        SPUtils.getInstance().put(PASSWORD, pwd);
    }

    /**
     * 输入密码错误次数/时间 格式："次数/时间"
     * @return 报错信息
     */
    public static String getBackstageErrCount() {
        return SPUtils.getInstance().getString(PASSWORDERRCOUNT, "");
    }

    /**
     * 保存密码错误信息 格式："次数/时间"
     * @param errMsg
     */
    public static void setBackstageErrCount(String errMsg){
        SPUtils.getInstance().put(PASSWORDERRCOUNT, errMsg);
    }

    /**
     * 是否显示首页logo
     * @param isShowLogo true-显示 false-不显示
     */
    public static void setShowLogo(boolean isShowLogo){
        SPUtils.getInstance().put(SHOWLOGO, isShowLogo);
    }

    /**
     * 获取显示首页logo参数
     * @return boolean
     */
    public static boolean getShowLogo(){
        return SPUtils.getInstance().getBoolean(SHOWLOGO, false);
    }

    /**
     * 设置门店和客服电话
     * @param sl 门店信息
     */
    public static void setSL(String sl){
        SPUtils.getInstance().put(STOREANDCONTACT, sl);
    }

    /**
     * 获取门店信息
     * @return 门店名称,客服电话
     */
    public static String getSL(){
        return SPUtils.getInstance().getString(STOREANDCONTACT, "88888888");
    }

    /**
     * 获取设备当班代号
     * @return 门店名称,客服电话
     */
    public static String getOndutyCode(){
        return SPUtils.getInstance().getString(ONDUTY_CODE, "admin");
    }

    /**
     * 获取设备当班代号
     * @return 门店名称,客服电话
     */
    public static void setOndutyCode(String ondutyCode){
        SPUtils.getInstance().put(ONDUTY_CODE, ondutyCode);
    }

    /**
     * 获取设备余额
     * @return
     */
    public static int getDeviceRemainCash(){
        return SPUtils.getInstance().getInt(DEVICE_CASH, 0);
    }

    /**
     * 保存设备余额
     * @return
     */
    public static void setDeviceRemainCash(int cash){
        SPUtils.getInstance().put(DEVICE_CASH, cash);
    }

    /**
     * 设置纸钞允许接收的面额
     * @param denomination
     */
    public static void setBanknoteDenomination1(String denomination){
        SPUtils.getInstance().put(DENOMINATION_1, denomination);
    }

    /**
     * 获取纸钞允许接收的面额
     */
    public static String getBanknoteDenomination1(){
        return SPUtils.getInstance().getString(DENOMINATION_1, "111111");
    }

    /**
     * 设置纸钞允许接收的面额
     * @param
     */
    public static void setCoinEnable(String coinEnable){
        SPUtils.getInstance().put(COIN_ENABLE, coinEnable);
    }

    /**
     * 获取纸钞允许接收的面额
     */
    public static String getCoinEnable(){
        return SPUtils.getInstance().getString(COIN_ENABLE, "11");
    }

    /**
     * 设置纸币机可用状态
     * @param
     */
    public static void setBanknoteEnable(String enable){
        SPUtils.getInstance().put(BANKNOTE_ENABLE, enable);
    }

    /**
     * 获取纸币机可用状态
     */
    public static String getBanknoteEnable(){
        return SPUtils.getInstance().getString(BANKNOTE_ENABLE, "11");
    }

    /**
     * 设置反扫器可用状态
     * @param
     */
    public static void setBackscanEnable(String enable){
        SPUtils.getInstance().put(BACKSCAN_ENABLE, enable);
    }

    /**
     * 获取反扫器可用状态
     */
    public static String getBackscanEnable(){
        return SPUtils.getInstance().getString(BACKSCAN_ENABLE, "1");
    }
    /**
     * 保存设备编号
     * @param
     */
    public static void setDeviceNumber(String deviceNumber){
        SPUtils.getInstance().put(DEVICE_NUMBER, deviceNumber);
    }

    /**
     * 获取设备编号
     */
    public static String getDeviceNumber(){
        return SPUtils.getInstance().getString(DEVICE_NUMBER, "");
    }

    /**
     * 保存纸币套餐
     * @param
     */
    public static void setCashPackage(String cashPackage){
        SPUtils.getInstance().put(CASH_PACKAGE, cashPackage);
    }

    /**
     * 获取纸币套餐
     */
    public static String getCashPackage(){
        return SPUtils.getInstance().getString(CASH_PACKAGE, "");
    }

    /**
     * 保存iccid
     * @param
     */
    public static void setIccid(String iccid){
        SPUtils.getInstance().put(ICCIC, iccid);
    }

    /**
     * 获取iccid
     */
    public static String getIccid(){
        return SPUtils.getInstance().getString(ICCIC, "");
    }

    /**
     * @param
     */
    public static void setControlPort(String port){
        SPUtils.getInstance().put(CONTROL_PORT, port);
    }

    /**
     */
    public static String getControlPort(){
        return SPUtils.getInstance().getString(CONTROL_PORT, Constant.PORT_COIN);
    }

    /**
     * @param
     */
    public static void setBanknotePort(String port){
        SPUtils.getInstance().put(BANKNOTE_PORT, port);
    }

    /**
     */
    public static String getBanknotePort(){
        return SPUtils.getInstance().getString(BANKNOTE_PORT, Constant.PORT_BANKNOTE);
    }

    /**
     * @param
     */
    public static void setBackscanPort(String port){
        SPUtils.getInstance().put(BACKSCAN_PORT, port);
    }

    /**
     */
    public static String getBackscanPort(){
        return SPUtils.getInstance().getString(BACKSCAN_PORT, Constant.PORT_BACKSCAN);
    }

    /**
     * 设置首页显示按钮
     * @param
     */
    public static void setHomeBtn(String homeBtn){
        SPUtils.getInstance().put(HOME_BTN_LIST, homeBtn);
    }

    /**
     * 获取首页显示按钮
     */
    public static String getHomeBtn(){
        return SPUtils.getInstance().getString(HOME_BTN_LIST, "0,1,2,4,5,6");
    }

    /**
     * 马达1状态
     * @param avaliable
     */
    public static void setMotor1(boolean avaliable){
        SPUtils.getInstance().put(MOTOR_1_STATE, avaliable);
    }

    /**
     * 马达1状态
     */
    public static boolean getMotor1(){
        return SPUtils.getInstance().getBoolean(MOTOR_1_STATE, true);
    }

    /**
     * 马达2状态
     * @param avaliable
     */
    public static void setMotor2(boolean avaliable){
        SPUtils.getInstance().put(MOTOR_2_STATE, avaliable);
    }

    /**
     * 马达2状态
     */
    public static boolean getMotor2(){
        return SPUtils.getInstance().getBoolean(MOTOR_2_STATE, true);
    }

    /**
     * 马达出币模式
     * @param type
     */
    public static void setMotorType(int type){
        SPUtils.getInstance().put(MOTOR_OUT_TYPE, type);
    }

    /**
     * 马达出币模式
     */
    public static int getMotorType(){
        return SPUtils.getInstance().getInt(MOTOR_OUT_TYPE, Constant.MOTOR_TYPE_ALTERNATELY);
    }

    /**
     * 保存接入平台类型
     * @param
     */
    public static void setAccessPlatform(int platform){
        SPUtils.getInstance().put(ACCESS_PLATFORM, platform);
    }

    /**
     * 获取接入平台类型
     */
    public static int getAccessPlatform(){
        return SPUtils.getInstance().getInt(ACCESS_PLATFORM, 0);
    }

    /**
     * 设置控制板类型
     * @param
     */
    public static void setControlType(int type){
        SPUtils.getInstance().put(CONTROL_TYPE, type);
    }

    /**
     * 获取纸币套餐
     */
    public static int getControlType(){
        return SPUtils.getInstance().getInt(CONTROL_TYPE, 0);
    }

    /**
     * @param
     */
    public static void setAutoInCoin(boolean autoInCoin){
        SPUtils.getInstance().put(AUTO_IN_COIN, autoInCoin);
    }

    /**
     */
    public static boolean getAutoInCoin(){
        return SPUtils.getInstance().getBoolean(AUTO_IN_COIN, true);
    }

    /**
     * 设置商品类型
     * @param
     */
    public static void setGoodType(int type){
        SPUtils.getInstance().put(GOOD_TYPE, type);
    }

    /**
     * 获取商品类型
     */
    public static int getGoodType(){
        return SPUtils.getInstance().getInt(GOOD_TYPE, 4);
    }
}